package com.huilian.iotbox.client.service.impl;

import com.huilian.iotbox.client.service.WeiXinService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.dto.WeiXinDto;
import com.huilian.tool.weixin.service.WeixinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

@Service
public class WeiXinServiceImpl implements WeiXinService {


    @Autowired
    private WeixinService weixinService;
    @Override
    public ServerResponse getWxJsSdkConfig(WeiXinDto weiXinDto) {

        if (StringUtils.isEmpty(weiXinDto.getUrl())) {
            return ServerResponse.createByErrorMessage("域名路径不能为空");
        }

        return ServerResponse.createBySuccess(weixinService.getWeiXinJsSdkConfig(weiXinDto.getUrl(), weixinService.getJsApiTicket()));
    }
}
